import { prisma } from '@/lib/prisma'
import { NextResponse } from 'next/server'

export async function GET() {
  const roles = await prisma.role.findMany()
  return NextResponse.json(roles)
}

export async function POST(request: Request) {
  const { name } = await request.json()
  const role = await prisma.role.create({
    data: {
      name,
    },
  })
  return NextResponse.json(role)
}